function $(id){
    return document.getElementById(id);
}

function hide(obj){
    obj.style.display = "none";
}
function show(obj){
    obj.style.display = "block";
}
function hideall(arr){
    for(var i=0;i<arr.length;i++){
        hide(arr[i]);
    }
}

function move(obj,target){
    clearInterval(obj.timeId);

    obj.timeId = setInterval(function () {
        //获取元素的当前的位置,数字类型
        var current = obj.offsetLeft;
        //每次移动的距离
        var step = 10;
        step = current < target ? step : -step;
        //当前移动到位置
        current += step;
        if (Math.abs(current - target) > Math.abs(step)) {
            obj.style.left = current + "px";
        } else {
            //清理定时器
            clearInterval(obj.timeId);
            //直接到达目标
            obj.style.left = target + "px";
        }
    }, 5);
}

